﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RepaymentNewForm.ascx.cs"
    Inherits="TVMCORP.TVS.ControlTemplates.TVMCORP.TVS.RepaymentNewForm" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBar" Src="~/_controltemplates/ToolBar.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBarButton" Src="~/_controltemplates/ToolBarButton.ascx" %>
<link href="../../_layouts/images/TVMCORP.TVS/css/style.css" rel="stylesheet" type="text/css" />
<script src="../../_layouts/1033/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="/_layouts/1033/request-script.js?Ver=<%=DateTime.Now.Ticks %>" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
    $(document).ready(function () {

        caculateTotal();
        //Call events
        callUSEvents();

        //
        $("#<%=rdbVND.ClientID%>").change(function () {
            caculateTotal();
        });
        $("#<%=rdbUSD.ClientID%>").change(function () {
            caculateTotal();
        });



    });

    //caculate
    function caculateTotal() {
        var total = 0;
        var currency = "VNĐ";
        //if ($("input[type='radio'].rad_currency").is(':checked')) {
        //    currency = $(this).val();
        //}
        if ($('#<%=rdbUSD.ClientID%>').is(":checked")) {
            currency = "USD";
        }

        $(".total_currency").each(function (e) {
            $(this).text(currency);
        });

        $(".table_request_detail tr.row2").each(function (e) {
            var amount = $(this).find('input.request_detail_input_number').val();
            if (amount != undefined && amount != '') {
                total += removeComma(amount) * 1;
            }
        });

        $("#total_price").text(formatNumber(total, ",", 3, 0));
        $("#total_price_text").text(DocTienBangChu(total));

        var amountRepayment = removeComma($("input.amount_repayment").val()) * 1;
        var totalResult = total - amountRepayment;

        $("#amount_repayment_text").text(DocTienBangChu(amountRepayment));
        $("#total_result").text(formatNumber(totalResult, ",", 3, 0));
        $("#total_result_text").text(DocTienBangChu(totalResult));

    }
</script>
<span id='part1'>
    <SharePoint:InformationBar ID="InformationBar1" runat="server" />
    <SharePoint:FormToolBar ID="FormToolBar1" runat="server" />
    <SharePoint:ItemValidationFailedMessage ID="ItemValidationFailedMessage1" runat="server" />
    <table class="ms-formtable" style="margin-top: 8px;" border="0" cellpadding="0" cellspacing="0"
        width="960px">
        <SharePoint:FolderFormFields ID="FolderFormFields1" runat="server" />
        <div class="container_form">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="40%" align="right">
                        <img src="../../_layouts/images/TVMCORP.TVS/logo_form.png" alt="logo" align="absmiddle" />
                    </td>
                    <td width="60%" class="title_company" align="center">
                        <asp:Literal ID="literalCompany" Text="CÔNG TY CỔ PHẦN TRUYỀN THÔNG TRÍ VIỆT" runat="server"></asp:Literal>
                        <br />
                        <span>
                            <asp:Literal ID="literalCompanyEnglish" Text="TRI VIET MEDIA CORP.(TVM)" runat="server"></asp:Literal>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="title_request" align="center">
                        <asp:Literal ID="literalRequestTitle" Text="ĐỀ NGHỊ HOÀN ỨNG" runat="server"></asp:Literal>
                    </td>
                </tr>
            </table>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="request_column1" width="50%" align="right">
                        <SharePoint:FieldLabel FieldName="Title" ID="flbTitle" ControlMode="Display" runat="server">
                        </SharePoint:FieldLabel>
                        :
                    </td>
                    <td class="request_column2" width="50%" align="left">
                        <SharePoint:FormField FieldName="Title" ID="ffTitle" runat="server">
                        </SharePoint:FormField>
                    </td>
                </tr>
                <tr>
                    <td class="request_column1" width="50%" align="right">
                        <SharePoint:FieldLabel FieldName="DateRequest" ID="flbDateRequest" ControlMode="Display"
                            runat="server">
                        </SharePoint:FieldLabel>
                        :
                    </td>
                    <td class="request_column2" width="50%" align="left">
                        <asp:Literal ID="literalDateRequestValue" Text="" runat="server"></asp:Literal>
                    </td>
                </tr>
                <tr>
                    <td class="request_column1" width="50%" align="right">
                        <SharePoint:FieldLabel FieldName="UserRequest" ID="flbUserRequest" ControlMode="Display"
                            runat="server">
                        </SharePoint:FieldLabel>
                        :
                    </td>
                    <td class="request_column2" width="50%" align="left">
                        <asp:Literal ID="literalUserRequestValue" Text="" runat="server"></asp:Literal>
                    </td>
                </tr>
                <tr>
                    <td class="request_column1" width="50%" align="right">
                        <SharePoint:FieldLabel FieldName="DepartmentRequest" ID="flbDepartmentRequest" ControlMode="Display"
                            runat="server">
                        </SharePoint:FieldLabel>
                        :
                    </td>
                    <td class="request_column2" width="50%" align="left">
                        <asp:Literal ID="literalDepartmentRequestValue" Text="" runat="server"></asp:Literal>
                    </td>
                </tr>
                <tr>
                    <td class="request_column1" width="50%" align="right">
                        <SharePoint:FieldLabel FieldName="TypeOfPayment" ID="flbTypeOfPayment" ControlMode="Display"
                            runat="server">
                        </SharePoint:FieldLabel>
                        :
                    </td>
                    <td class="request_column2" width="50%" align="left">
                        <SharePoint:FormField FieldName="TypeOfPayment" ID="ffTypeOfPayment" runat="server">
                        </SharePoint:FormField>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        &nbsp;&nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table width="100%" cellspacing="0" cellpadding="0" class="tablelist table_request_detail"
                            border="2" style="border-collapse: collapse">
                            <tr>
                                <td style="border: 1px solid #45aefe; padding: 5px 0px 5px 0px; text-transform: uppercase;
                                    font: bold 16px Arial, Helvetica, sans-serif;" colspan="4">
                                    Nội dung hoàn ứng
                                </td>
                            </tr>
                            <tr class="row2">
                                <td style="border: 1px solid #45aefe; padding: 5px 5px 5px 5px;" class="payment_currency"
                                    align="center" valign="middle" colspan="4">
                                    <asp:RadioButton ID="rdbVND" Text="VND" GroupName="Currency" Checked="true" runat="server" />
                                    &nbsp;&nbsp;
                                    <asp:RadioButton ID="rdbUSD" Text="USD" GroupName="Currency" runat="server" />
                                </td>
                            </tr>
                            <tr class="row_title">
                                <td style="border: 1px solid #45aefe;" width="5%" align="center" valign="middle">
                                    STT
                                </td>
                                <td style="border: 1px solid #45aefe;" width="50%" align="center" valign="middle">
                                    Nội dung
                                </td>
                                <td style="border: 1px solid #45aefe;" width="35%" align="center" valign="middle">
                                    Số tiền
                                </td>
                                <td style="border: 1px solid #45aefe;" width="5%" align="center" valign="middle">
                                    Xóa
                                </td>
                            </tr>
                            <asp:Repeater ID="repeaterRequestDetail" runat="server">
                                <HeaderTemplate>
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <tr class="row2">
                                        <td style="border: 1px solid #45aefe;" align="center" valign="middle" class="request_text_lable">
                                            <asp:HiddenField ID="hiddenFieldId" runat="server" />
                                            <asp:Literal ID="literalOrder" runat="server"></asp:Literal>
                                        </td>
                                        <td style="border: 1px solid #45aefe;" align="left" valign="middle" class="request_text_lable">
                                            <asp:TextBox ID="txtContent" CssClass="request_detail_title" Width="100%" MaxLength="255"
                                                runat="server"></asp:TextBox>
                                        </td>
                                        <td style="border: 1px solid #45aefe;" align="right" valign="middle" class="request_text_lable">
                                            <asp:TextBox ID="txtAmount" CssClass="request_detail_input_number" Width="100%" MaxLength="10"
                                                runat="server"></asp:TextBox>
                                        </td>
                                        <td style="border: 1px solid #45aefe;" align="center" valign="middle" class="request_text_lable hide_on_click clickable">
                                            <img src="../../_layouts/images/TVMCORP.TVS/deletel-icon-16.png" alt="Xóa" />
                                        </td>
                                    </tr>
                                </ItemTemplate>
                                <FooterTemplate>
                                </FooterTemplate>
                            </asp:Repeater>
                            <tr>
                                <td style="border: 1px solid #45aefe; padding: 5px 5px 5px 5px;" align="right" valign="middle"
                                    colspan="4">
                                    <b>Tổng số tiền hoàn ứng : &nbsp;&nbsp; <span id="total_price"></span>&nbsp; <span
                                        class="total_currency"></span>
                                        <br />
                                        <i>(<span id="total_price_text"></span> <span class="total_currency"></span>)</i>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid #45aefe; padding: 5px 5px 5px 5px;" align="right" valign="middle"
                                    colspan="4">
                                    <b>Số tiền đã tạm ứng hoặc còn tạm ứng : &nbsp;&nbsp;
                                        <asp:TextBox ID="txtAmountRepayment" CssClass="request_detail_input_number amount_repayment"
                                            Width="100px" MaxLength="10" runat="server"></asp:TextBox>
                                        &nbsp; <span class="total_currency" style="float: right;"></span>
                                        <br />
                                        <i>(<span id="amount_repayment_text"></span> <span class="total_currency"></span>)</i>
                                    </b>
                                </td>
                            </tr>
                            <tr class="row2">
                                <td style="border: 1px solid #45aefe; padding: 5px 5px 5px 5px;" align="right" valign="middle"
                                    colspan="4">
                                    <b>Chênh lệch : &nbsp;&nbsp; <span id="total_result"></span>&nbsp; <span class="total_currency">
                                    </span>
                                        <br />
                                        <i>(<span id="total_result_text"></span> <span class="total_currency"></span>)</i>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td style="border: 1px solid #45aefe; padding: 5px 5px 5px 5px;" colspan="4">
                                    <asp:LinkButton ID="linkButtonAdd" CausesValidation="false" runat="server"><i>Thêm dòng</i></asp:LinkButton>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        &nbsp;&nbsp;
                        <br />
                        &nbsp;&nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table width="100%" cellspacing="0" cellpadding="0" class="tablelist" border="2"
                            style="border-collapse: collapse">
                            <tr class="row_title">
                                <td style="border: 1px solid #45aefe;" width="100%" align="center" valign="middle">
                                    <SharePoint:FieldLabel FieldName="TypeOfRepayment" ID="flbTypeOfRepayment" runat="server">
                                    </SharePoint:FieldLabel>
                                </td>
                            </tr>
                            <tr class="row2">
                                <td style="border: 1px solid #45aefe;" align="center" valign="middle" class="request_text_lable">
                                    <asp:RadioButtonList ID="rdbListTypeOfRepayment" RepeatColumns="6" runat="server">
                                    </asp:RadioButtonList>
                                </td>
                            </tr>
                            <%--<tr class="row2">
                                <td style="border: 1px solid #45aefe;" align="center" valign="middle" class="request_text_lable">
                                    <SharePoint:FormField FieldName="TypeOfRepayment" ID="ffTypeOfRepayment" runat="server">
                                    </SharePoint:FormField>
                                </td>
                            </tr>--%>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        &nbsp;&nbsp;
                        <br />
                        &nbsp;&nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table width="100%" cellspacing="0" cellpadding="0" class="tablelist table_reference"
                            border="2" style="border-collapse: collapse">
                            <tr>
                                <td style="border: 1px solid #45aefe; padding: 5px 0px 5px 0px; text-transform: uppercase;
                                    font: bold 16px Arial, Helvetica, sans-serif;" colspan="2">
                                    Đề nghị tham chiếu
                                </td>
                            </tr>
                            <tr class="row_title">
                                <td style="border: 1px solid #45aefe;" width="100%" align="center" valign="middle">
                                    Chọn đề nghị tham chiếu
                                </td>
                            </tr>
                            <tr class="row2 row_reference">
                                <td style="border: 1px solid #45aefe;" align="center" valign="middle" class="request_text_lable">
                                    <SharePoint:FormField FieldName="References" ID="ffReferences" runat="server" CssClass="ctl_reference">
                                    </SharePoint:FormField>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        &nbsp;&nbsp;
                        <br />
                        &nbsp;&nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table width="100%" cellspacing="0" cellpadding="0" class="tablelist" border="2"
                            style="border-collapse: collapse">
                            <tr>
                                <td style="border: 1px solid #45aefe; padding: 5px 0px 5px 0px; text-transform: uppercase;
                                    font: bold 16px Arial, Helvetica, sans-serif;" colspan="4">
                                    Thông tin duyệt
                                </td>
                            </tr>
                            <tr class="row_title">
                                <td style="border: 1px solid #45aefe;" width="20%" align="center" valign="middle">
                                    Trưởng bộ phận
                                </td>
                                <td style="border: 1px solid #45aefe;" width="20%" align="center" valign="middle">
                                    Kế toán kiểm tra
                                </td>
                                <td style="border: 1px solid #45aefe;" width="20%" align="center" valign="middle">
                                    Kế toán trưởng
                                </td>
                                <td style="border: 1px solid #45aefe;" width="20%" align="center" valign="middle">
                                    Người phê duyệt
                                </td>
                            </tr>
                            <tr class="row2">
                                <td style="border: 1px solid #45aefe;" align="left" valign="middle" class="request_text_lable">
                                    <SharePoint:PeopleEditor ID="peChief" runat="server" SelectionSet="User" CssClass="ms-usereditor"
                                        MultiSelect="false" AllowEmpty="True" ShowDataValidationErrorBorder="False" ValidatorEnabled="True"
                                        ValidateResolvedEntity="True" />
                                </td>
                                <td style="border: 1px solid #45aefe;" align="left" valign="middle" class="request_text_lable">
                                    <SharePoint:PeopleEditor ID="peAccountant" runat="server" SelectionSet="User" CssClass="ms-usereditor"
                                        MultiSelect="false" AllowEmpty="True" ShowDataValidationErrorBorder="False" ValidatorEnabled="True"
                                        ValidateResolvedEntity="True" />
                                </td>
                                <td style="border: 1px solid #45aefe;" align="left" valign="middle" class="request_text_lable">
                                    <SharePoint:PeopleEditor ID="peHeadAccountant" runat="server" SelectionSet="User"
                                        CssClass="ms-usereditor" MultiSelect="false" AllowEmpty="True" ShowDataValidationErrorBorder="False"
                                        ValidatorEnabled="True" ValidateResolvedEntity="True" />
                                </td>
                                <td style="border: 1px solid #45aefe;" align="left" valign="middle" class="request_text_lable">
                                    <SharePoint:PeopleEditor ID="peApprover" runat="server" SelectionSet="User" CssClass="ms-usereditor"
                                        MultiSelect="false" AllowEmpty="True" ShowDataValidationErrorBorder="False" ValidatorEnabled="True"
                                        ValidateResolvedEntity="True" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        &nbsp;&nbsp;
                        <br />
                        &nbsp;&nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <%--<SharePoint:ApprovalStatus ID="ApprovalStatus1" runat="server" />--%>
                        <SharePoint:FormComponent ID="FormComponent1" TemplateName="AttachmentRows" runat="server" />
                    </td>
                </tr>
            </table>
        </div>
    </table>
    <table cellpadding="0" cellspacing="0" width="100%">
        <tr>
            <td class="ms-formline">
                <img src="/_layouts/images/blank.gif" width='1' height='1' alt="" />
            </td>
        </tr>
    </table>
    <table cellpadding="0" cellspacing="0" width="100%" style="padding-top: 7px">
        <tr>
            <td width="100%">
                <SharePoint:ItemHiddenVersion ID="ItemHiddenVersion1" runat="server" />
                <SharePoint:ParentInformationField ID="ParentInformationField1" runat="server" />
                <SharePoint:InitContentType ID="InitContentType1" runat="server" />
                <wssuc:ToolBar CssClass="ms-formtoolbar" ID="toolBarTbl" RightButtonSeparator="&amp;#160;"
                    runat="server">
                    <Template_Buttons>
                        <SharePoint:CreatedModifiedInfo ID="CreatedModifiedInfo1" runat="server" />
                    </Template_Buttons>
                    <Template_RightButtons>
                        <asp:Button ID="btnSave" runat="server" CssClass="ms-ButtonHeightWidth" Text="Save" />
                        <SharePoint:GoBackButton ID="GoBackButton2" runat="server" />
                    </Template_RightButtons>
                </wssuc:ToolBar>
            </td>
        </tr>
    </table>
</span>
<SharePoint:AttachmentUpload ID="AttachmentUpload1" runat="server" />
